<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8" />
        <title>21_案例练习-求数组中平均数</title>
    </head>
    <body>
        <script>
            var arr = [6,5,3,1,8,7,2,4];

            var sum = 0;

            for(var i = 0; i < arr.length; i++){
                sum += arr[i];
            }

            console.log(sum / arr.length);
        </script>
    </body>
</html>